package org.example.stack;

import java.util.ArrayDeque;

public class ArrayDequeAsStackExample {
    public static void main(String[] args) {
        ArrayDeque<String> stack = new ArrayDeque<>();

        stack.push("元素1");
        stack.push("元素2");
        stack.push("元素3");

        System.out.println("栈顶元素：" + stack.peek());

        System.out.println("弹出的元素：" + stack.pop());
        System.out.println("弹出的元素：" + stack.pop());

        System.out.println("栈是否为空：" + stack.isEmpty());
    }
}